Skip to content

feat(agent-device): a download over 2 GB fails, never cut short - #561

Merged
V3RON merged 4 commits into
feature/552-adrfrom
task/557
Oct 14, 2026
Merged

V3RON merged 4 commits into
feature/552-adrfrom
task/557

Conversation

@V3RON

@V3RON V3RON commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #557

Status

Implement: done (11/11 green) Review: round 1, 1 src fixed, fix-check clean Hardware: n/a Gate: waiting for the stack

Built and audited: the host caps downloads at 2 GiB; spec tests pass locally (edge, gateway-front, download-cap); each added test probed by breaking the code it covers (the as-today upload test cannot fail from the host by design).

Done when

  • Every Tests line passes (test: edge, gateway-front and download-cap tests, green on the head; CI checked).
  • A download over 2 GB is refused with 413 when its size is known, and aborted otherwise (test: same files, plus HTTP-API.md documents the limit).

Assumptions

  • Assumption: the fake's direct upload route keeps each upload's text only up to 1 MiB (a marker beyond), plus a size and digest in uploadSummaries — the spec allows a digest, and small uploads read as before.
  • Assumption: the "content-length counted as absent" tests serve one byte past the limit under the bad header, so the counter's error is what ends the body.
  • Assumption: src/http/server.ts wraps the response so a body that errors mid-stream closes the connection abnormally — the node adapter otherwise ends it cleanly, which would let a cut-short download look whole; the spec's "never ends cleanly" requires it.

Review

Spec review: 0 blocking, 0 fixed, 1 notes. Code review: 1 blocking, 1 fixed, 1 notes. Claims review: 0 blocking, 0 fixed, 2 notes.
Rounds: 1. Tokens: 2.7M.

Rejected:

  • spec: src/http/server.ts:554 wrapping every gateway response is blocking — not blocking: only affects bodies already failing mid-stream
  • code: src/http/server.ts:581 chunk terminator edge 3 bytes short — not blocking: vanishingly narrow, no rule breached

Written by an agent.

@V3RON

V3RON commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Review notes

Not blocking, not verified. Each is one reviewer's claim.

  • spec: src/http/server.ts:554 abortOnBodyError wraps every gateway response, so a body failing mid-stream on any route now drops the connection (Assumption 3).
  • code: src/http/server.ts:579 the wrapper swallows the body error and logs nothing; a cut download leaves no trace in daemon logs.
  • claims: src/agent-device/edge.test.ts:3811 title says RPC and preflight replies "pass unchanged"; the host rewrites the preflight upload url.
  • claims: docs/HTTP-API.md:1495 scopes the 2 GB cap to "Downloads (artifacts)"; capped applies to every non-preflight proxied response.

Written by an agent.

@V3RON
V3RON marked this pull request as ready for review October 14, 2026 12:56
@V3RON
V3RON added this pull request to stack #566 October 14, 2026 12:56
@V3RON
V3RON merged commit f0d1b92 into main Oct 14, 2026
41 of 50 checks passed
@V3RON
V3RON deleted the task/557 branch October 14, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(agent-device): a download over 2 GB fails, never cut short

1 participant